<?php

/*
 *	Arguments: category id
 *	Operation: Returns an array of all the users in the system MINUS the member users of that category
 *		(its moderators, creators, member register users, whatever).
 *	Return: An Array of objects of type User
 *	Author: Panos
 */

function BL_getUsersPruned($categoryId)
{
	if($categoryId < 0)
 	{
     		return BL_GET_USERS_PRUNED;
  	}

	$users = DB_getusers();

	$category_users = DB_getCategoryUsers($categoryId);
	$category_mods = DB_getCategoryModerators($categoryId);

	$prunedCount = 0;

	for($i = 0; $i < count($users); $i++)
	{
		$found = 0;

		for($j = 0; $j < count($category_users); $j++)
		{
			if($category_users[$j] == $users[$i]['id'])
			{
				$found = 1;
                break;
			}
		}

        if($found != 1){
            for($j = 0; $j < count($category_mods); $j++)
		    {
			    if($category_mods[$j] == $users[$i]['id'])
		    	{
				    $found = 1;
                    break;
			    }
		    }
        }

		if($found == 0)
		{
			$prunedUsers[$prunedCount] = $users[$i];
			$prunedCount++;
		}
	}

	return $prunedUsers;
}

?>